object dm_usuario: Tdm_usuario
  OldCreateOrder = False
  OnCreate = DataModuleCreate
  Left = 499
  Top = 243
  Height = 382
  Width = 507
  object sqlConsulta: TSQLQuery
    MaxBlobSize = -1
    Params = <
      item
        DataType = ftInteger
        Name = 'empresa'
        ParamType = ptInput
      end>
    SQL.Strings = (
      'select'
      '  u.cod_usuario,'
      '  u.descricao,'
      '  u.login,'
      '  u.senha,'
      '  u.senha_liberacao,'
      '  u.senha_data_expira,'
      '  u.senha_atualizar,'
      '  case'
      '    when u.senha_atualizar = '#39'True'#39' then '#39'Sim'#39' else '#39'N'#227'o'#39
      '  end as senha_atualizar_desc,'
      '  u.permitir_acesso,'
      '  case'
      '    when u.permitir_acesso = '#39'True'#39' then '#39'Sim'#39' else '#39'N'#227'o'#39
      '  end as permitir_acesso_desc,'
      '  u.permitir_acesso_restrito,'
      '  case'
      
        '    when u.permitir_acesso_restrito = '#39'True'#39' then '#39'Sim'#39' else '#39'N'#227 +
        'o'#39
      '  end as permitir_acesso_restrito_desc,'
      '  u.alerta_email,'
      '  u.alerta_email_enviar,'
      '  u.alerta_sms,'
      '  u.alerta_sms_enviar,'
      '  u.foto,'
      '  u.obs,'
      '  u.data_cad,'
      '  u.data_alteracao,'
      '  ug.descricao as grupo_acesso'
      'from usuario_multiempresa um'
      'left join usuario u on (u.cod_usuario = um.lig_cod_usuario)'
      'left join usuario_grupo ug on (ug.cod_grupo = um.lig_cod_grupo)'
      'where um.lig_cod_empresa = :empresa')
    SQLConnection = dmGeral.SQLConnectionBD
    Left = 208
    Top = 16
  end
  object cdsConsulta: TClientDataSet
    Active = True
    Aggregates = <>
    Params = <>
    ProviderName = 'dspConsulta'
    Left = 208
    Top = 112
    object cdsConsultaCOD_USUARIO: TIntegerField
      Alignment = taCenter
      FieldName = 'COD_USUARIO'
      Required = True
    end
    object cdsConsultaDESCRICAO: TStringField
      FieldName = 'DESCRICAO'
      Required = True
      Size = 100
    end
    object cdsConsultaLOGIN: TStringField
      FieldName = 'LOGIN'
      Required = True
      Size = 30
    end
    object cdsConsultaSENHA: TStringField
      FieldName = 'SENHA'
      Required = True
      Size = 30
    end
    object cdsConsultaSENHA_LIBERACAO: TStringField
      FieldName = 'SENHA_LIBERACAO'
      Size = 30
    end
    object cdsConsultaSENHA_DATA_EXPIRA: TDateField
      Alignment = taCenter
      FieldName = 'SENHA_DATA_EXPIRA'
    end
    object cdsConsultaSENHA_ATUALIZAR: TStringField
      Alignment = taCenter
      FieldName = 'SENHA_ATUALIZAR'
      Size = 5
    end
    object cdsConsultaSENHA_ATUALIZAR_DESC: TStringField
      Alignment = taCenter
      FieldName = 'SENHA_ATUALIZAR_DESC'
      Required = True
      FixedChar = True
      Size = 3
    end
    object cdsConsultaPERMITIR_ACESSO: TStringField
      Alignment = taCenter
      FieldName = 'PERMITIR_ACESSO'
      Size = 5
    end
    object cdsConsultaPERMITIR_ACESSO_DESC: TStringField
      Alignment = taCenter
      FieldName = 'PERMITIR_ACESSO_DESC'
      Required = True
      FixedChar = True
      Size = 3
    end
    object cdsConsultaPERMITIR_ACESSO_RESTRITO: TStringField
      Alignment = taCenter
      FieldName = 'PERMITIR_ACESSO_RESTRITO'
      Size = 5
    end
    object cdsConsultaPERMITIR_ACESSO_RESTRITO_DESC: TStringField
      Alignment = taCenter
      FieldName = 'PERMITIR_ACESSO_RESTRITO_DESC'
      Required = True
      FixedChar = True
      Size = 3
    end
    object cdsConsultaALERTA_EMAIL: TStringField
      FieldName = 'ALERTA_EMAIL'
      Size = 100
    end
    object cdsConsultaALERTA_EMAIL_ENVIAR: TStringField
      Alignment = taCenter
      FieldName = 'ALERTA_EMAIL_ENVIAR'
      Size = 5
    end
    object cdsConsultaALERTA_SMS: TStringField
      Alignment = taCenter
      FieldName = 'ALERTA_SMS'
      Size = 15
    end
    object cdsConsultaALERTA_SMS_ENVIAR: TStringField
      Alignment = taCenter
      FieldName = 'ALERTA_SMS_ENVIAR'
      Size = 5
    end
    object cdsConsultaFOTO: TStringField
      FieldName = 'FOTO'
      Size = 30
    end
    object cdsConsultaOBS: TStringField
      FieldName = 'OBS'
      Size = 10000
    end
    object cdsConsultaDATA_CAD: TDateField
      Alignment = taCenter
      FieldName = 'DATA_CAD'
    end
    object cdsConsultaDATA_ALTERACAO: TDateField
      Alignment = taCenter
      FieldName = 'DATA_ALTERACAO'
    end
    object cdsConsultaGRUPO_ACESSO: TStringField
      FieldName = 'GRUPO_ACESSO'
      Size = 100
    end
    object cdsConsultasqlConsultaMultiEmp: TDataSetField
      FieldName = 'sqlConsultaMultiEmp'
    end
  end
  object dspConsulta: TDataSetProvider
    DataSet = sqlConsulta
    Left = 208
    Top = 64
  end
  object cdsUsuario: TClientDataSet
    Aggregates = <>
    Params = <>
    ProviderName = 'dspUsuario'
    OnReconcileError = cdsUsuarioReconcileError
    Left = 288
    Top = 112
    object cdsUsuarioCOD_USUARIO: TIntegerField
      FieldName = 'COD_USUARIO'
      Required = True
    end
    object cdsUsuarioDESCRICAO: TStringField
      FieldName = 'DESCRICAO'
      Size = 100
    end
    object cdsUsuarioLOGIN: TStringField
      FieldName = 'LOGIN'
      Size = 30
    end
    object cdsUsuarioSENHA: TStringField
      FieldName = 'SENHA'
      Size = 30
    end
    object cdsUsuarioSENHA_LIBERACAO: TStringField
      FieldName = 'SENHA_LIBERACAO'
      Size = 30
    end
    object cdsUsuarioSENHA_DATA_EXPIRA: TDateField
      FieldName = 'SENHA_DATA_EXPIRA'
    end
    object cdsUsuarioSENHA_ATUALIZAR: TStringField
      FieldName = 'SENHA_ATUALIZAR'
      Size = 5
    end
    object cdsUsuarioPERMITIR_ACESSO: TStringField
      FieldName = 'PERMITIR_ACESSO'
      Size = 5
    end
    object cdsUsuarioPERMITIR_ACESSO_RESTRITO: TStringField
      FieldName = 'PERMITIR_ACESSO_RESTRITO'
      Size = 5
    end
    object cdsUsuarioALERTA_EMAIL: TStringField
      FieldName = 'ALERTA_EMAIL'
      Size = 100
    end
    object cdsUsuarioALERTA_EMAIL_ENVIAR: TStringField
      FieldName = 'ALERTA_EMAIL_ENVIAR'
      Size = 5
    end
    object cdsUsuarioALERTA_SMS: TStringField
      FieldName = 'ALERTA_SMS'
      Size = 15
    end
    object cdsUsuarioALERTA_SMS_ENVIAR: TStringField
      FieldName = 'ALERTA_SMS_ENVIAR'
      Size = 5
    end
    object cdsUsuarioFOTO: TStringField
      FieldName = 'FOTO'
      Size = 30
    end
    object cdsUsuarioOBS: TStringField
      FieldName = 'OBS'
      Size = 10000
    end
    object cdsUsuarioDATA_CAD: TDateField
      FieldName = 'DATA_CAD'
    end
    object cdsUsuarioDATA_ALTERACAO: TDateField
      FieldName = 'DATA_ALTERACAO'
    end
  end
  object dspUsuario: TDataSetProvider
    DataSet = sqlUsuario
    Left = 288
    Top = 64
  end
  object sqlUsuario: TSQLQuery
    MaxBlobSize = -1
    Params = <
      item
        DataType = ftInteger
        Name = 'usuario'
        ParamType = ptInput
      end>
    SQL.Strings = (
      'select'
      '  u.cod_usuario,'
      '  u.descricao,'
      '  u.login,'
      '  u.senha,'
      '  u.senha_liberacao,'
      '  u.senha_data_expira,'
      '  u.senha_atualizar,'
      '  u.permitir_acesso,'
      '  u.permitir_acesso_restrito,'
      '  u.alerta_email,'
      '  u.alerta_email_enviar,'
      '  u.alerta_sms,'
      '  u.alerta_sms_enviar,'
      '  u.foto,'
      '  u.obs,'
      '  u.data_cad,'
      '  u.data_alteracao'
      'from USUARIO u'
      'where u.cod_usuario = :usuario')
    SQLConnection = dmGeral.SQLConnectionBD
    Left = 288
    Top = 16
  end
  object qryMaxUsuario: TSQLQuery
    MaxBlobSize = -1
    Params = <>
    SQL.Strings = (
      'SELECT GEN_ID(gen_usuario,1)'
      'FROM RDB$DATABASE')
    SQLConnection = dmGeral.SQLConnectionBD
    Left = 34
    Top = 216
    object qryMaxUsuarioGEN_ID: TFMTBCDField
      FieldName = 'GEN_ID'
      Required = True
      Precision = 15
      Size = 0
    end
  end
  object spAtualizarRPA_01: TSQLStoredProc
    MaxBlobSize = -1
    Params = <
      item
        DataType = ftInteger
        Name = 'COD_USUARIO'
        ParamType = ptInput
      end>
    SQLConnection = dmGeral.SQLConnectionBD
    StoredProcName = 'USUARIO_ATUALIZAR_RPA_01'
    Left = 192
    Top = 208
  end
  object spAtualizarRPA_02: TSQLStoredProc
    MaxBlobSize = -1
    Params = <
      item
        DataType = ftInteger
        Name = 'COD_USUARIO'
        ParamType = ptInput
      end
      item
        DataType = ftInteger
        Name = 'COD_EMPRESA'
        ParamType = ptInput
      end
      item
        DataType = ftInteger
        Name = 'COD_GRUPO'
        ParamType = ptInput
      end>
    SQLConnection = dmGeral.SQLConnectionBD
    StoredProcName = 'USUARIO_ATUALIZAR_RPA_02'
    Left = 296
    Top = 208
  end
  object sqlUsuarioMultiEmp: TSQLQuery
    MaxBlobSize = -1
    Params = <
      item
        DataType = ftInteger
        Name = 'usuario'
        ParamType = ptInput
      end>
    SQL.Strings = (
      'select'
      '  u.lig_cod_empresa,'
      '  u.lig_cod_usuario,'
      '  u.lig_cod_grupo,'
      '  a.descricao as grupo'
      'from usuario_multiempresa u'
      'left join usuario_grupo a on (a.cod_grupo = u.lig_cod_grupo)'
      'where u.lig_cod_usuario = :usuario')
    SQLConnection = dmGeral.SQLConnectionBD
    Left = 384
    Top = 16
  end
  object cdsUsuarioMultiEmp: TClientDataSet
    Aggregates = <>
    Params = <>
    ProviderName = 'dspUsuarioMultiEmp'
    Left = 384
    Top = 112
    object cdsUsuarioMultiEmpLIG_COD_EMPRESA: TIntegerField
      FieldName = 'LIG_COD_EMPRESA'
      Required = True
    end
    object cdsUsuarioMultiEmpLIG_COD_USUARIO: TIntegerField
      FieldName = 'LIG_COD_USUARIO'
      Required = True
    end
    object cdsUsuarioMultiEmpLIG_COD_GRUPO: TIntegerField
      FieldName = 'LIG_COD_GRUPO'
      Required = True
    end
    object cdsUsuarioMultiEmpGRUPO: TStringField
      FieldName = 'GRUPO'
      Size = 100
    end
  end
  object dspUsuarioMultiEmp: TDataSetProvider
    DataSet = sqlUsuarioMultiEmp
    Left = 384
    Top = 64
  end
  object dsMestreDetail: TDataSource
    DataSet = sqlConsulta
    Left = 136
    Top = 16
  end
  object sqlConsultaMultiEmp: TSQLQuery
    DataSource = dsMestreDetail
    MaxBlobSize = -1
    Params = <
      item
        DataType = ftInteger
        Name = 'COD_USUARIO'
        ParamType = ptInput
        Size = 4
      end>
    SQL.Strings = (
      'select'
      '  a.descricao_multiempresa,'
      '  b.descricao as grupo'
      'from usuario_multiempresa u'
      'left join empresa a on (a.cod_empresa = u.lig_cod_empresa)'
      'left join usuario_grupo b on (b.cod_grupo = u.lig_cod_grupo)'
      'where u.lig_cod_usuario = :cod_usuario'
      'order by a.descricao_multiempresa')
    SQLConnection = dmGeral.SQLConnectionBD
    Left = 40
    Top = 16
    object sqlConsultaMultiEmpDESCRICAO_MULTIEMPRESA: TStringField
      FieldName = 'DESCRICAO_MULTIEMPRESA'
      Size = 50
    end
    object sqlConsultaMultiEmpGRUPO: TStringField
      FieldName = 'GRUPO'
      Size = 100
    end
  end
  object cdsConsultaMultiEmp: TClientDataSet
    Active = True
    Aggregates = <>
    DataSetField = cdsConsultasqlConsultaMultiEmp
    Params = <>
    Left = 40
    Top = 64
    object cdsConsultaMultiEmpDESCRICAO_MULTIEMPRESA: TStringField
      FieldName = 'DESCRICAO_MULTIEMPRESA'
      Size = 50
    end
    object cdsConsultaMultiEmpGRUPO: TStringField
      FieldName = 'GRUPO'
      Size = 100
    end
  end
end
